perm filename FREE.SAI[USE,CSR]  blob 
sn#611569 filedate 1981-09-14 generic text, type C, neo UTF8
 
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	begin "free"
C00006 ENDMK
C⊗;
begin "free"
comment this will scan the address file, creating another file containing
	the addresses of all customers who are classed as "free".  The list
	will be in FREE.DSK;
comment The method is to move through the address file, one entry at a time.
	If the entry is in the free class (first character after the * is
	F) copy the address into the target file;
define crlf = "('15&'12)";
define ff = "'14";
boolean eof;
integer flag, ichan, ochan, baddr, brchar;
string addr;
comment Set breaktable, to read one address;
setbreak(baddr←getbreak,"*",null,"IS"); 
eof←0;
comment Open channels for input and output;
open(ichan←getchan,"DSK",0,19,0,450,brchar,eof);
open(ochan←getchan,"DSK",0,0,19,0,0,eof);
lookup(ichan,"ADDFIL.DSK",flag);
if flag then print("Can't find address file.",crlf);
enter(ochan,"FREE.DSK",flag);
if flag then print("Can't open target file.",crlf);
comment The main loop.  Proceed through the address file one at a time;
addr←input(ichan, baddr);
do begin "next address"
	if addr="F" then
	    out(ochan,"*"&(if addr[∞ to ∞]=ff then addr[1 to ∞-1] else addr));
	addr←input(ichan,baddr);
    end "next address"
until eof;
close(ichan); close(ochan);
end "free";